{{#tree}}
    {{^-first}} OR {{/-first}}
    (
    {{#parts}}
        {{^-first}} AND {{/-first}}
        {{^opIn}}
            {{^opNotIn}}
                {{#ignoreCase}}{{lowercaseFunction}}({{column.name}}){{/ignoreCase}}
                {{^ignoreCase}}{{column.name}}{{/ignoreCase}}
            {{/opNotIn}}
        {{/opIn}}
        {{#opBetween}}
            BETWEEN
            {{#arguments}}
                {{^-first}} AND {{/-first}} {{.}}
            {{/arguments}}
        {{/opBetween}}
        {{#opNotNull}} IS NOT NULL {{/opNotNull}}
        {{#opNull}} IS NULL {{/opNull}}
        {{#opRlike}} LIKE
        <bind name="__bind_{{#arguments}}{{.}}{{/arguments}}"
              value="{{#arguments}}{{.}}{{/arguments}}+'%'"/>
        {{#ignoreCase}}{{lowercaseFunction}}(#{
        __bind_{{#arguments}}{{.}}{{/arguments}} }){{/ignoreCase}}
        {{^ignoreCase}}
            #{ __bind_{{#arguments}}{{.}}{{/arguments}} }{{/ignoreCase}}
        {{/opRlike}}
        {{#opLlike}}
            LIKE
            <bind name="__bind_{{#arguments}}{{.}}{{/arguments}}"
                  value="'%'+{{#arguments}}{{.}}{{/arguments}}"/>
            {{#ignoreCase}}
                {{lowercaseFunction}}(#{ __bind_{{#arguments}}{{.}}{{/arguments}}
                })
            {{/ignoreCase}}
            {{^ignoreCase}}
                #{ __bind_{{#arguments}}{{.}}{{/arguments}} }
            {{/ignoreCase}}
        {{/opLlike}}
        {{#opLike}}{{#opNotLike}} NOT {{/opNotLike}} LIKE
        <bind name="__bind_{{#arguments}}{{.}}{{/arguments}}"
              value="'%'+{{#arguments}}{{.}}{{/arguments}}+'%'"/>
        {{#ignoreCase}}{{lowercaseFunction}}(#{
        __bind_{{#arguments}}{{.}}{{/arguments}} }){{/ignoreCase}}
        {{^ignoreCase}}
            #{ __bind_{{#arguments}}{{.}}{{/arguments}} }{{/ignoreCase}}
        {{/opLike}}
        {{#opIn}}
            <choose>
                <when test="{{#arguments}}{{.}}{{/arguments}} != null and {{#arguments}}{{.}}{{/arguments}}.{{#arrayParameter}}length{{/arrayParameter}}{{^arrayParameter}}size(){{/arrayParameter}} > 0">
                    {{#ignoreCase}}{{lowercaseFunction}}({{column.name}}){{/ignoreCase}}
                    {{^ignoreCase}}{{column.name}}{{/ignoreCase}}
                    IN
                    <foreach item="__item" index="__index"
                             collection="{{#arguments}}{{.}}{{/arguments}}" open="("
                             separator="," close=")">#{__item
                        {{#column.hasJavaType}}
                            ,javaType={{column.javaTypeString}}
                        {{/column.hasJavaType}}
                        {{#column.hasTypeHandler}}
                            ,typeHandler={{column.typeHandlerString}}
                        {{/column.hasTypeHandler}} }
                    </foreach>
                </when>
                <otherwise>0=1</otherwise>
            </choose>
        {{/opIn}}
        {{#opNotIn}}
            <choose>
                <when test="{{#arguments}}{{.}}{{/arguments}} != null and {{#arguments}}{{.}}{{/arguments}}.{{#arrayParameter}}length{{/arrayParameter}}{{^arrayParameter}}size(){{/arrayParameter}} > 0">
                    {{#ignoreCase}}{{lowercaseFunction}}({{column.name}}){{/ignoreCase}}
                    {{^ignoreCase}}{{column.name}}{{/ignoreCase}}
                    NOT IN
                    <foreach item="__item" index="__index"
                             collection="{{#arguments}}{{.}}{{/arguments}}" open="("
                             separator="," close=")">#{__item
                        {{#column.hasJavaType}}
                            ,javaType={{column.javaTypeString}}
                        {{/column.hasJavaType}}
                        {{#column.hasTypeHandler}}
                            ,typeHandler={{column.typeHandlerString}}
                        {{/column.hasTypeHandler}} }
                    </foreach>
                </when>
                <otherwise>0=1</otherwise>
            </choose>
        {{/opNotIn}}
        {{#opTrue}} = 1 {{/opTrue}}
        {{#opFalse}} = 0 {{/opFalse}}
        {{#opDefault}}
            {{#opSimpleProperty}}={{/opSimpleProperty}}
            {{#opNegatingSimpleProperty}}&lt;&gt;{{/opNegatingSimpleProperty}}
            {{#opLessThan}}&lt;{{/opLessThan}}
            {{#opBefore}}&lt;{{/opBefore}}
            {{#opLessThanEqual}}&lt;={{/opLessThanEqual}}
            {{#opGreaterThan}}&gt;{{/opGreaterThan}}
            {{#opAfter}}&gt;{{/opAfter}}
            {{#opGreaterThanEqual}}&gt;={{/opGreaterThanEqual}}
            {{#ignoreCase}}
                {{lowercaseFunction}}(#{ {{#arguments}}{{.}}{{/arguments}}
                })
            {{/ignoreCase}}
            {{^ignoreCase}}
                #{ {{#arguments}}{{.}}{{/arguments}}
                {{#column.hasJavaType}}
                    ,javaType={{column.javaTypeString}}
                {{/column.hasJavaType}}
                {{#column.hasTypeHandler}}
                    ,typeHandler={{column.typeHandlerString}}
                {{/column.hasTypeHandler}} }
            {{/ignoreCase}}
        {{/opDefault}}
    {{/parts}}
    )
{{/tree}}
